package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;

@Getter@Setter
public class TravelCommend extends BaseDomain{

    public static final int TYPE_WEEK = 1 ;//每周推荐
    public static final int TYPE_MONTH = 2 ;//每月推荐
    public static final int type_strategy = 3 ;//攻略推荐
    //游记id
    private Long travelId;

    //标题
    private String title;

    //副标题
    private String subTitle;

    //封面
    private String coverUrl;

    //推荐时间安排
    @JsonFormat(pattern = "y-M-d",timezone = "GMT+8")
    @DateTimeFormat(pattern = "y-M-d")
    private Date schedule;

    //推荐类型
    private Integer type;

    public String getJson(){
        HashMap<String, Object> map = new HashMap<>();
        map.put("id",id);
        map.put("travelId",travelId);
        map.put("title",title);
        map.put("subTitle",subTitle);
        map.put("coverUrl",coverUrl);
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("y-M-d");
        map.put("schedule",simpleDateFormat.format(schedule));
        map.put("type",type);
        return JSONUtil.toJSONString(map);
    }

}